package com.ruoyi.mes.material.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mes.material.mapper.SmesMaterialArriveBillDetailMapper;
import com.ruoyi.mes.material.domain.SmesMaterialArriveBillDetail;
import com.ruoyi.mes.material.service.ISmesMaterialArriveBillDetailService;

/**
 * 原料采购明细Service业务层处理
 *
 * @author simpsense
 * @date 2020-12-10
 */
@Service
public class SmesMaterialArriveBillDetailServiceImpl implements ISmesMaterialArriveBillDetailService
{
    @Autowired
    private SmesMaterialArriveBillDetailMapper smesMaterialArriveBillDetailMapper;

    /**
     * 查询原料采购明细
     *
     * @param rowId 原料采购明细ID
     * @return 原料采购明细
     */
    @Override
    public SmesMaterialArriveBillDetail selectSmesMaterialArriveBillDetailById(Long rowId)
    {
        return smesMaterialArriveBillDetailMapper.selectSmesMaterialArriveBillDetailById(rowId);
    }

    /**
     * 查询原料采购明细列表
     *
     * @param smesMaterialArriveBillDetail 原料采购明细
     * @return 原料采购明细
     */
    @Override
    public List<SmesMaterialArriveBillDetail> selectSmesMaterialArriveBillDetailList(SmesMaterialArriveBillDetail smesMaterialArriveBillDetail)
    {
        return smesMaterialArriveBillDetailMapper.selectSmesMaterialArriveBillDetailList(smesMaterialArriveBillDetail);
    }

    /**
     * 新增原料采购明细
     *
     * @param smesMaterialArriveBillDetail 原料采购明细
     * @return 结果
     */
    @Override
    public int insertSmesMaterialArriveBillDetail(SmesMaterialArriveBillDetail smesMaterialArriveBillDetail)
    {
        smesMaterialArriveBillDetail.setBuyBy(SecurityUtils.getUsername());
        smesMaterialArriveBillDetail.setBuyTime(DateUtils.getNowDate());

        return smesMaterialArriveBillDetailMapper.insertSmesMaterialArriveBillDetail(smesMaterialArriveBillDetail);
    }

    /**
     * 修改原料采购明细
     *
     * @param smesMaterialArriveBillDetail 原料采购明细
     * @return 结果
     */
    @Override
    public int updateSmesMaterialArriveBillDetail(SmesMaterialArriveBillDetail smesMaterialArriveBillDetail)
    {
        return smesMaterialArriveBillDetailMapper.updateSmesMaterialArriveBillDetail(smesMaterialArriveBillDetail);
    }

    /**
     * 批量删除原料采购明细
     *
     * @param rowIds 需要删除的原料采购明细ID
     * @return 结果
     */
    @Override
    public int deleteSmesMaterialArriveBillDetailByIds(Long[] rowIds)
    {
        return smesMaterialArriveBillDetailMapper.deleteSmesMaterialArriveBillDetailByIds(rowIds);
    }

    /**
     * 删除原料采购明细信息
     *
     * @param rowId 原料采购明细ID
     * @return 结果
     */
    @Override
    public int deleteSmesMaterialArriveBillDetailById(Long rowId)
    {
        return smesMaterialArriveBillDetailMapper.deleteSmesMaterialArriveBillDetailById(rowId);
    }
}